package top.kaoshanji.ch03;

import top.kaoshanji.ch03.beans.Agent;
import top.kaoshanji.ch03.beans.AgentFinder;

import java.util.List;

/**
 * 代码清单 ch03-02：HollywoodService由工厂负责提供AgentFinder
 * @see AgentFinderFactory
 * author kaoshanji
 * ^_^
 * create time 2024/12/14 16:03
 */
public class HollywoodServiceV2 {

    public static List<Agent> getFriendlyAgents(String agentFinderType) {

        AgentFinderFactory factory = AgentFinderFactory.getInstance();
        AgentFinder finder = factory.getAgentFinder(agentFinderType);
        List<Agent> agents = finder.findAllAgents();

        return HollywoodFilter.filterAgents(agents, "Java Developers");

    }


}
